Skip to content

Conversation

copybara-service[bot]
Copy link

@copybara-service copybara-service bot commented Apr 4, 2025

Rename enum constants in ObjC proto code if they would clash with reserved names.

Previously the code just didn't emit a constant at all. Now, we do emit one, but with an extra underscore. For example, if the enum constant is OVERFLOW, which collides with a macro in /usr/include/math.h, we'll output OVERFLOW_ instead. So client code can still reference it, albeit a little clumsily.

Eventually we should change the hardcoded list of reserved names to use the same reserved names list that the j2objc translator uses.

…erved names.

Previously the code just didn't emit a constant at all. Now, we do emit one, but with an extra underscore. For example, if the enum constant is `OVERFLOW`, which collides with a macro in `/usr/include/math.h`, we'll output `OVERFLOW_` instead. So client code can still reference it, albeit a little clumsily.

Eventually we should change the hardcoded list of reserved names to use the same [reserved names list](https://github.com/google/j2objc/blob/master/translator/src/main/resources/com/google/devtools/j2objc/reserved_names.txt) that the j2objc translator uses.

PiperOrigin-RevId: 743258491
@copybara-service copybara-service bot changed the title Rename enum constants in ObjC code if they would clash with reserved names. Rename enum constants in ObjC proto code if they would clash with reserved names. Apr 4, 2025
@copybara-service copybara-service bot closed this Jul 16, 2025
@copybara-service copybara-service bot deleted the test_743258491 branch July 16, 2025 00:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant